package com.netintech.intelligenceInterface.iflytek.controller.realtimeTranscribe;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

/**
 * @author lining
 * @ 2020/5/25 20:41
 */
@Configuration
@EnableWebSocket
public class WsConfigure implements WebSocketConfigurer {

    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
        registry.addHandler(myHandler(), "/realtimeTranscribe/*")
                .setAllowedOriginPatterns("*")
                .addInterceptors(new WebSocketInterceptor());
    }

    @Bean
    public WsHandler myHandler() {
        return new WsHandler();
    }

}
